home *** CD-ROM | disk | FTP | other *** search
/ 3D Screen Savers / 3D Screen Savers.iso / win31 / setup.mst < prev    next >
Text File  |  1997-08-29  |  6KB  |  202 lines

  1.     '' Global variables
  2.  
  3.     GLOBAL TitleShortName$
  4.     GLOBAL TitleLongName$
  5.     GLOBAL PromptForPath%
  6.     GLOBAL DefaultPath$
  7.     GLOBAL ProgManGroup$
  8.     GLOBAL ProgManItem$
  9.  
  10.     '' ****************************************************************
  11.     '' ** Setup Variables
  12.     '' ****************************************************************
  13.  
  14.     TitleShortName$ = "3D Screen Saver"
  15.     TitleLongName$ = "3D Screen Saver"
  16.     ProgmanGroup$ = "3D Screen Saver"
  17.  
  18.     '***********************************************************************
  19.     '** Mainline
  20.     '***********************************************************************
  21.  
  22.     GLOBAL CUIDLL$
  23.  
  24.     '' Include files
  25.     '$INCLUDE 'setupapi.inc'
  26.  
  27.     '' Custom UI dll
  28.     CUIDLL$ = "mscuistf.dll"
  29.  
  30.     '' Dialog ID's
  31.     CONST DESTPATH      = 1000
  32.     CONST APPHELP       = 2000
  33.     CONST TOOBIG        = 3000
  34.     CONST BADPATH       = 4000
  35.     CONST SUCCESS       = 5000
  36.  
  37.     '' Bitmap ID
  38.     CONST LOGO = 1
  39.  
  40.     '' Functions and subroutines
  41.     DECLARE FUNCTION AddFont LIB "mscuistf.dll" (szFont$, szName$) AS INTEGER
  42.     DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  43.     DECLARE FUNCTION CopyFiles(szTitleDir$) AS INTEGER
  44.     DECLARE FUNCTION ChkAgreement LIB "vecuistf.dll" AS INTEGER
  45.     DECLARE SUB ShowSuccess
  46.     DECLARE SUB ModifyProgramManager
  47.  
  48.     '' The following statement turns size checking off. Set it to scmOnFatal
  49.     '' to enable size checking, where Setup will compare the disk file size
  50.     '' with the INF file size and report an error if they are not the same.
  51.  
  52.     i% = SetSizeCheckMode(scmOff)
  53.  
  54.     '' Set the title and banner bitmap. You must rebuild MSCUISTF.DLL to
  55.     '' alter the banner bitmap.
  56.  
  57.     SetTitle "3D Screen Saver Setup"
  58.     SetBitmap "vecuistf.dll", LOGO
  59.  
  60.     '' Check for agreement
  61.     IF ChkAgreement() = 0 THEN
  62.         GOTO QUIT
  63.     ENDIF
  64.  
  65.     '' Read in the INF file.
  66.  
  67.     ReadInfFile GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  68.     szTitleDir$ = GetWindowsDir()
  69.  
  70.     '' Copy files
  71.     IF CopyFiles(szTitleDir$) = 0 THEN
  72.         GOTO QUIT
  73.     ENDIF
  74.  
  75.     CreateIniKeyValue szTitleDir$ + "CONTROL.INI", "Screen Saver.3D Screen Saver", "Mirror", szTitleDir$, cmoOverwrite
  76. ''    CreateIniKeyValue szTitleDir$ + "CONTROL.INI", "Screen Saver.3D Screen Saver", "CD", GetSymbolValue("STF_SRCDIR"), cmoOverwrite
  77.     CreateIniKeyValue szTitleDir$ + "SYSTEM.INI", "boot", "SCRNSAVE.EXE", szTitleDir$ + "3DSSAVER.SCR", cmoOverwrite
  78.  
  79.     ModifyProgramManager
  80.  
  81.     '' Success dialog
  82. ''    ShowSuccess
  83.  
  84. QUIT:
  85.  
  86.     END
  87.  
  88. '*************************************************************************
  89. '** Purpose:
  90. '**     Copies the files in the INF file
  91. '** Arguments:
  92. '**     szTitleDir$ - destination directory for the title files
  93. '** Returns
  94. '**     1 if files were copied, 0 otherwise
  95. '*************************************************************************
  96.  
  97. FUNCTION CopyFiles(szTitleDir$) STATIC AS INTEGER
  98.  
  99.     '' Add all system files to the copy list
  100.     AddSectionFilesToCopyList "System Files", GetSymbolValue("STF_SRCDIR"), GetWindowsSysDir()
  101.     AddSectionFilesToCopyList "3D Screen Saver Files", GetSymbolValue("STF_SRCDIR"), szTitleDir$
  102.  
  103.     '' Check size
  104.     szExtras$ = "Extra"
  105.     szCosts$ = "Costs"
  106.     szNeededs$ = "Neededs"
  107.     FOR i% = 1 TO 26 STEP 1
  108.         AddListItem szExtras$, "0"
  109.     NEXT i%
  110.  
  111.     '' Get amount of space required
  112.     StillNeed& = GetCopyListCost(szExtras$, szCosts$, szNeededs$)
  113.  
  114.     '' Put up a message if there is not enough space
  115.     FOR i% = 1 TO 26 STEP 1
  116.         IF VAL(GetListItem(szNeededs$, i%)) > 0 THEN
  117.  
  118.             SetSymbolValue "String1", LTRIM$(STR$(VAL(GetListItem(szCosts$, i%)) / 1024))
  119.             SetSymbolValue "String2", CHR$(i% - 1 + ASC("A"))
  120.  
  121.             TOOBIG:
  122.  
  123.             sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc", 0, "")
  124.             IF sz$ = "REACTIVATE" THEN
  125.                 GOTO TOOBIG
  126.             END IF
  127.             UIPop 1
  128.             CopyFiles = 0
  129.             GOTO DONTCOPY
  130.         END IF
  131.     NEXT i%
  132.  
  133.     '' Copy the files
  134.     CopyFilesInCopyList
  135.  
  136.     CopyFiles = 1
  137.  
  138. DONTCOPY:
  139.  
  140. END FUNCTION
  141.  
  142.  
  143. '*************************************************************************
  144. '** Purpose:
  145. '**     Puts up a success dialog
  146. '*************************************************************************
  147.  
  148. SUB ShowSuccess STATIC
  149.  
  150.     SUCCESS:
  151.  
  152.     SetSymbolValue "String1", TitleShortName$
  153.     sz$ = UIStartDlg(CUIDLL$, SUCCESS, "FInfoDlgProc", 0, "")
  154.     IF sz$ = "REACTIVATE" THEN
  155.         GOTO SUCCESS
  156.     END IF
  157.     UIPop 1
  158.  
  159. END SUB
  160.  
  161.  
  162. '*************************************************************************
  163. '** Purpose:
  164. '**     Appends a file name to the end of a directory path,
  165. '**     inserting a backslash character as needed.
  166. '** Arguments:
  167. '**     szDir$  - full directory path (with optional ending "\")
  168. '**     szFile$ - filename to append to directory
  169. '** Returns:
  170. '**     Resulting fully qualified path name.
  171. '*************************************************************************
  172.  
  173. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  174.     IF szDir$ = "" THEN
  175.         MakePath = szFile$
  176.     ELSEIF szFile$ = "" THEN
  177.         MakePath = szDir$
  178.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  179.         MakePath = szDir$ + szFile$
  180.     ELSE
  181.         MakePath = szDir$ + "\" + szFile$
  182.     END IF
  183. END FUNCTION
  184.  
  185. '*************************************************************************
  186. '** Purpose:
  187. '**     Creates program manager entries
  188. '*************************************************************************
  189.  
  190. SUB ModifyProgramManager STATIC
  191.  
  192.     '' Create the program manager group
  193.  
  194.     CreateProgmanGroup ProgmanGroup$, "", cmoNone
  195.     ShowProgmanGroup ProgmanGroup$, 1, cmoNone
  196.  
  197.     '' Create icons
  198.     CreateProgmanItem ProgmanGroup$, "VE Player", "veplayer.exe mono", "", cmoOverwrite
  199.     CreateProgmanItem ProgmanGroup$, "VE Player - Stereoscopic", "veplayer.exe stereo", "", cmoOverwrite
  200.  
  201. END SUB
  202.